<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>T^',
                    '<div>x|est OK<br>...more text</div>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>T|est OK<div>...more text</div></div>',
            '</div>',
        ].join('')),
        'Delete a character at start of line');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>X^',
                    '<div>should not see this content<br>|Y</div>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                'X|Y',
            '</div>',
        ].join('')),
        'Delete characters and BR');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>X',
                    '^<div>should not see this content<br>Y|Z</div>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                'X|Z',
            '</div>',
        ].join('')),
        'Delete characters starting from DIV and BR');

    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<div>X',
                    '^<div>should not see this content<br>Y|Z<br>AB</div>',
                '</div>',
            '</div>',
        ].join(''),
        'delete',
        [
            '<div contenteditable>',
                '<div>X|Z<div>AB</div></div>',
            '</div>',
        ].join('')),
        'Delete characters containing BR following characters and BR');
</script>
